<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图区域 -->
    <el-card class="box-card">
      <el-table :data="rightsList" style="width: 100%" stripe border>
        <el-table-column
          type="index"
          label="#"
          align="center"
        ></el-table-column>
        <el-table-column prop="authName" label="权限名称" align="center">
        </el-table-column>
        <el-table-column prop="path" label="权限路径" align="center">
        </el-table-column>
        <el-table-column prop="level" label="权限等级" align="center">
          <template v-slot="soltScope">
            <el-tag type="success" v-if="soltScope.row.level === '0'"
              >一级</el-tag
            >
            <el-tag type="info" v-else-if="soltScope.row.level === '1'"
              >二级</el-tag
            >
            <el-tag type="warning" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script type="text/ecmascript-6">
import { reqRightsList } from "../../api";
export default {
  data() {
    return {
      rightsList: [],
    };
  },
  mounted() {
    this.getRightsList();
  },
  methods: {
    async getRightsList() {
      const result = await reqRightsList();
      this.rightsList = result.data;
    },
  },
};
</script>

<style lang="less" scoped>
.el-card {
  margin-top: 20px;
}
</style>
